{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑轮播图</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">上标题：</label>
                            <div class="layui-input-block">
                                <textarea name="pb_title_up" placeholder="文字介绍" class="layui-input" style="height: 100px;">{$banner.pb_title_up}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">下标题：</label>
                            <div class="layui-input-block">
                                <input type="text" name="pb_title" placeholder="标题"  value="{$banner.pb_title}" class="layui-input ">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">展示位置：</label>
                            <div class="layui-input-block">
                                <select name="pb_where">
                                    {if $banner.pb_type == 1}
                                    <option value="1" {if $banner.pb_where == 1}selected{/if}>轮播图</option>
                                    <option value="2" {if $banner.pb_where == 2}selected{/if}>案例相册</option>
                                    <option value="3" {if $banner.pb_where == 3}selected{/if}>现场照片</option>
                                    {else /}
                                    <option value="4" {if $banner.pb_where == 4}selected{/if}>案例视频</option>
                                    {/if}
                                </select>
                            </div>
                        </div>
                        {if $banner.pb_type != 2}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">图片：</label>
                            <input type="hidden" name="pb_url" id="lay-img" lay-verify="image" value="{$banner.pb_url}">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                        <img class="layui-append-img" src="{$banner.pb_url}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        {else /}
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">视频：</label>
                            <input type="hidden" name="video" id="lay-img2" lay-verify="image" value="{$banner.pb_url}">
                            <div class="layui-input-block">
                                <div id="lay-upload2">上传视频</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览：
                                    <div class="layui-upload-list" id="lay-list2">
                                        <video class="layui-append-img" src="{$banner.pb_url}" controls="controls"></video>
                                    </div>
                                </blockquote>
                            </div>
                        </div>
                        {/if}
                        <input type="hidden" value="{$banner.pb_id}" name="pb_id">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    wk.uploadImg({size:200,num:2,type:'MP4,Mp4,mP4,mp4',url:"{:url('Upload/upload')}",video:3}); //视频
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('bannerEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
                            wk.layer_close();
                        })
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>

</body>
</html>
